package com.bt.dmdb.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.TableGenerator;

import org.hibernate.annotations.Type;
import org.joda.time.LocalDateTime;

import com.bt.dmdb.json.converter.JsonDateDeserializer;
import com.bt.dmdb.json.converter.JsonDateSerializer;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;




@Entity
@Table(name = "contact")
@SuppressWarnings("serial")
public class ContactCopy implements java.io.Serializable
{
	
private Long id;
private String contactType;
private String firstName;
private String lastName;
private String emailId;
private String phoneNo;
private String mobileNo;

private CustomerCopy customerCopy;
private LoginUser createdBy;


private LocalDateTime creationDate;




public ContactCopy(){}

public ContactCopy(Long id, String contactType, String firstName,
		String lastName, String emailId, String phoneNo, String mobileNo,
		CustomerCopy customerCopy, LoginUser createdBy,
		LocalDateTime creationDate) {
	super();
	this.id = id;
	this.contactType = contactType;
	this.firstName = firstName;
	this.lastName = lastName;
	this.emailId = emailId;
	this.phoneNo = phoneNo;
	this.mobileNo = mobileNo;
	this.customerCopy = customerCopy;
	this.createdBy = createdBy;

	this.creationDate = creationDate;

}




@Id
@GeneratedValue(generator = "contactCopyIG", strategy = GenerationType.TABLE)
@TableGenerator(name = "contactCopyIG", table = "jpa_sequences", pkColumnName = "name", pkColumnValue = "ContactCopy", allocationSize = 10, valueColumnName = "next_hi_value")
public Long getId() {
	return id;
}

public void setId(Long id) {
	this.id = id;
}

@Column(name = "contact_type", nullable = false, length = 50)
public String getContactType() {
	return contactType;
}

public void setContactType(String contactType) {
	this.contactType = contactType;
}

@Column(name = "first_name", nullable = false, length = 50)
public String getFirstName() {
	return firstName;
}

public void setFirstName(String firstName) {
	this.firstName = firstName;
}

@Column(name = "last_name", nullable = false, length = 50)
public String getLastName() {
	return lastName;
}

public void setLastName(String lastName) {
	this.lastName = lastName;
}

@Column(name = "email", nullable = false, length = 50)
public String getEmailId() {
	return emailId;
}

public void setEmailId(String emailId) {
	this.emailId = emailId;
}

@Column(name = "phone_no", nullable = false, length = 50)
public String getPhoneNo() {
	return phoneNo;
}

public void setPhoneNo(String phoneNo) {
	this.phoneNo = phoneNo;
}


@Column(name = "mobile_no", nullable = false, length = 50)
public String getMobileNo() {
	return mobileNo;
}

public void setMobileNo(String mobileNo) {
	this.mobileNo = mobileNo;
}

@Column(name = "creation_date")
@Type(type = "org.jadira.usertype.dateandtime.joda.PersistentLocalDateTime")
@JsonSerialize(using = JsonDateSerializer.class)
@JsonDeserialize(using = JsonDateDeserializer.class)
public LocalDateTime getCreationDate() {
	return creationDate;
}

public void setCreationDate(LocalDateTime creationDate) {
	this.creationDate = creationDate;
}





@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "customer_id")
public CustomerCopy getCustomerCopy() {
	return customerCopy;
}

public void setCustomerCopy(CustomerCopy customerCopy) {
	this.customerCopy = customerCopy;
}

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "created_by")
public LoginUser getCreatedBy() {
	return createdBy;
}

public void setCreatedBy(LoginUser createdBy) {
	this.createdBy = createdBy;
}


}